package largestNumberBuilder;

import java.util.Arrays;
import java.util.Scanner;

public class LargestNumberBuilder {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String[] input = new String[4];
        for(int i=0;i<4;i++){
            input[i]=scanner.next();
        }

        char[][] numbers = new char[4][];
        for (int i = 0; i < 4; i++) {
            numbers[i] = input[i].toCharArray();
        }

        Arrays.sort(numbers, (a, b) -> {
            String aStr = new String(a) + new String(b);
            String bStr = new String(b) + new String(a);
            return bStr.compareTo(aStr);
        });

        StringBuilder largestNumber = new StringBuilder();
        for (char[] number : numbers) {
            largestNumber.append(number);
        }

        System.out.println("The largest number is: " + largestNumber);
        scanner.close();
    }
}
